/**********************************************************************************************************
** 驱动文件：	jmkt-DataMate3000.c
** 驱动类型：	jmkt
** 设备名称：	艾默生精密空调
** 设备型号：	DataMate3000
** 设备品牌：	艾默生
** 设备协议：	电总协议
** 驱动描述：	本协议是《监控行标第三部分：智能设备通信协议》（电总协议）的简化版本，适用于艾默生网络能源有限公司基站小空调产品DataMate3000系列精密空调的环境监控。
** 生成日期：	2018-10-25 23:47:03
**********************************************************************************************************/
#include "Includes.h"


/**********************************************************************************************************
* 定义设备数据点变量结构
**********************************************************************************************************/
typedef struct{
	Var indoorTemperature;						//室内温度
	Var indoorHumidity;							//室内湿度
	Var outdoorTemperature;						//室外温度
	Var setTemperature;							//温度设定点
	Var setHumidity;							//湿度设定点
	Var onoff;									//开关机状态
	Var fanStatus;								//风机状态
	Var coolingStatus;							//制冷状态
	Var heatingStatus;							//加热状态
	Var humidificationStatus;					//加湿状态
	Var dehumidificationStatus;					//除湿状态
	Var pressureAlarm;							//高/低压报警
	Var temperatureAlarm;						//高/低温报警
	Var humidityAlarm;							//高/低湿报警
	Var powerFailureAlarm;						//电源故障报警
	Var shortPeriodAlarm;						//短周期报警
	Var mainFanMaintenanceAlarm;				//主风机维护报警
	Var humidifierMaintenanceAlarm;				//加湿器维护报警
	Var filterMaintenanceAlarm;					//过滤网维护报警
	Var communicationFailureAlarm;				//通讯故障报警
	Var coilFreezeAlarm;						//盘管冻结报警
	Var humidifierFailureAlarm;					//加湿器故障报警
	Var sensorBoardLossAlarm;					//传感器板丢失报警
	Var exhaustTemperatureFaultAlarm;			//排气温度故障报警
	Var powerLossFaultAlarm;					//电源丢失故障报警
	Var powerOverVoltageAlarm;					//电源过欠压报警
	Var powerSupplyPhaseLossAlarm;				//电源缺相报警
	Var powerFrequencyOffsetAlarm;				//电源频率偏移报警
	Var floorOverflowAlarm;						//地板溢水报警
	Var energySavingCardFailure;				//节能卡故障
}Data_Struct;									//定义变量结构


/**********************************************************************************************************
* 设备数据点变量属性声明
**********************************************************************************************************/
const static Var_Property_Def var_attr[] = {
	{
		FLOAT,
		0,
		READONLY,
		"indoorTemperature",
		"室内温度",
		"℃",
		"当前室内温度",
		0,
		0,
		"室内温度过高",
		"室内温度过低",
		0.000,
		0.000
	},
	{
		FLOAT,
		0,
		READONLY,
		"indoorHumidity",
		"室内湿度",
		"%",
		"当前室内湿度",
		0,
		0,
		"室内湿度过高",
		"室内湿度过低",
		0.000,
		0.000
	},
	{
		FLOAT,
		0,
		READONLY,
		"outdoorTemperature",
		"室外温度",
		"℃",
		"当前室外温度",
		0,
		0,
		"室外温度过高",
		"室外温度过低",
		0.000,
		0.000
	},
	{
		FLOAT,
		0,
		READONLY,
		"setTemperature",
		"温度设定点",
		"℃",
		"空调设定温度值",
		0,
		0,
		"",
		"",
		0.000,
		0.000
	},
	{
		FLOAT,
		0,
		READONLY,
		"setHumidity",
		"湿度设定点",
		"%",
		"空调设定湿度值",
		0,
		0,
		"",
		"",
		0.000,
		0.000
	},
	{
		OCTSTR,
		0,
		READONLY,
		"onoff",
		"开关机状态",
		"",
		"空调开关机状态：0-关机；1-开机",
		0,
		0,
		"空调关机",
		"",
		0.000,
		0.000
	},
	{
		OCTSTR,
		0,
		READONLY,
		"fanStatus",
		"风机状态",
		"",
		"风机状态：0-停止；1-运行",
		0,
		0,
		"",
		"",
		0.000,
		0.000
	},
	{
		OCTSTR,
		0,
		READONLY,
		"coolingStatus",
		"制冷状态",
		"",
		"制冷状态：0-停止；1-运行",
		0,
		0,
		"",
		"",
		0.000,
		0.000
	},
	{
		OCTSTR,
		0,
		READONLY,
		"heatingStatus",
		"加热状态",
		"",
		"加热状态：0-停止；1-运行",
		0,
		0,
		"",
		"",
		0.000,
		0.000
	},
	{
		OCTSTR,
		0,
		READONLY,
		"humidificationStatus",
		"加湿状态",
		"",
		"加湿状态：0-停止；1-运行",
		0,
		0,
		"",
		"",
		0.000,
		0.000
	},
	{
		OCTSTR,
		0,
		READONLY,
		"dehumidificationStatus",
		"除湿状态",
		"",
		"除湿状态：0-停止；1-运行",
		0,
		0,
		"",
		"",
		0.000,
		0.000
	},
	{
		OCTSTR,
		0,
		READONLY,
		"pressureAlarm",
		"高/低压报警",
		"",
		"高压、低压报警：0-无报警；1-高压报警；2-低压报警",
		0,
		0,
		"有报警",
		"",
		0.000,
		0.000
	},
	{
		OCTSTR,
		0,
		READONLY,
		"temperatureAlarm",
		"高/低温报警",
		"",
		"高温、低温报警：0-无报警；1-高温报警；2-低温报警",
		0,
		0,
		"有报警",
		"",
		0.000,
		0.000
	},
	{
		OCTSTR,
		0,
		READONLY,
		"humidityAlarm",
		"高/低湿报警",
		"",
		"高湿、低湿报警：0-无报警；1-髙湿报警；2-低湿报警",
		0,
		0,
		"有报警",
		"",
		0.000,
		0.000
	},
	{
		OCTSTR,
		0,
		READONLY,
		"powerFailureAlarm",
		"电源故障报警",
		"",
		"电源故障报警：0-无报警；1-有报警",
		0,
		0,
		"有报警",
		"",
		0.000,
		0.000
	},
	{
		OCTSTR,
		0,
		READONLY,
		"shortPeriodAlarm",
		"短周期报警",
		"",
		"短周期报警：0-无报警；1-有报警",
		0,
		0,
		"有报警",
		"",
		0.000,
		0.000
	},
	{
		OCTSTR,
		0,
		READONLY,
		"mainFanMaintenanceAlarm",
		"主风机维护报警",
		"",
		"主风机维护报警：0-无报警；1-有报警",
		0,
		0,
		"有报警",
		"",
		0.000,
		0.000
	},
	{
		OCTSTR,
		0,
		READONLY,
		"humidifierMaintenanceAlarm",
		"加湿器维护报警",
		"",
		"加湿器维护报警：0-无报警；1-有报警",
		0,
		0,
		"有报警",
		"",
		0.000,
		0.000
	},
	{
		OCTSTR,
		0,
		READONLY,
		"filterMaintenanceAlarm",
		"过滤网维护报警",
		"",
		"过滤网维护报警:0-无报警；1-有报警",
		0,
		0,
		"有报警",
		"",
		0.000,
		0.000
	},
	{
		OCTSTR,
		0,
		READONLY,
		"communicationFailureAlarm",
		"通讯故障报警",
		"",
		"通讯故障报警：0-无报警；1-有报警",
		0,
		0,
		"有报警",
		"",
		0.000,
		0.000
	},
	{
		OCTSTR,
		0,
		READONLY,
		"coilFreezeAlarm",
		"盘管冻结报警",
		"",
		"盘管冻结报警：0-无报警；1-有报警",
		0,
		0,
		"有报警",
		"",
		0.000,
		0.000
	},
	{
		OCTSTR,
		0,
		READONLY,
		"humidifierFailureAlarm",
		"加湿器故障报警",
		"",
		"加湿器故障报警：0-无报警；1-有报警",
		0,
		0,
		"有报警",
		"",
		0.000,
		0.000
	},
	{
		OCTSTR,
		0,
		READONLY,
		"sensorBoardLossAlarm",
		"传感器板丢失报警",
		"",
		"传感器板丢失报警：0-无报警；1-有报警",
		0,
		0,
		"有报警",
		"",
		0.000,
		0.000
	},
	{
		OCTSTR,
		0,
		READONLY,
		"exhaustTemperatureFaultAlarm",
		"排气温度故障报警",
		"",
		"排气温度故障报警：0-无报警；1-有报警",
		0,
		0,
		"有报警",
		"",
		0.000,
		0.000
	},
	{
		OCTSTR,
		0,
		READONLY,
		"powerLossFaultAlarm",
		"电源丢失故障报警",
		"",
		"电源丢失故障报警：0-无报警；1-有报警",
		0,
		0,
		"有报警",
		"",
		0.000,
		0.000
	},
	{
		OCTSTR,
		0,
		READONLY,
		"powerOverVoltageAlarm",
		"电源过欠压报警",
		"",
		"电源过欠压报警：0-无报警；1-有报警",
		0,
		0,
		"有报警",
		"",
		0.000,
		0.000
	},
	{
		OCTSTR,
		0,
		READONLY,
		"powerSupplyPhaseLossAlarm",
		"电源缺相报警",
		"",
		"电源缺相报警：0-无报警；1-有报警",
		0,
		0,
		"有报警",
		"",
		0.000,
		0.000
	},
	{
		OCTSTR,
		0,
		READONLY,
		"powerFrequencyOffsetAlarm",
		"电源频率偏移报警",
		"",
		"电源频率偏移报警：0-无报警；1-有报警",
		0,
		0,
		"有报警",
		"",
		0.000,
		0.000
	},
	{
		OCTSTR,
		0,
		READONLY,
		"floorOverflowAlarm",
		"地板溢水报警",
		"",
		"地板溢水报警：0-无报警；1-有报警",
		0,
		0,
		"有报警",
		"",
		0.000,
		0.000
	},
	{
		OCTSTR,
		0,
		READONLY,
		"energySavingCardFailure",
		"节能卡故障",
		"",
		"节能卡故障：0-无报警；1-有报警",
		0,
		0,
		"有报警",
		"",
		0.000,
		0.000
	}
};

/**********************************************************************************************************
* 函数名称： static void cmd_fun(short index, int addr, void *data, char *cmd, short *len)
* 函数说明： 生成获取传感器数据指令
* 输入参数： 指令索引，传感器地址，变量结构体指针,以及指令缓存区指针,指令长度
* 返回参数： 无
**********************************************************************************************************/
static void cmd_fun(short index, int addr, void *data, char *cmd, short *len)
{
	unsigned short i,n,sum;
	switch(index)
	{
		case 0:	//获取模拟量数据	7E 32 31 30 31 36 30 34 32 30 30 30 30 46 44 42 30 0D
			*len = sprintf(cmd,"\x7E\x32\x31\x30\x31\x36\x30\x34\x32\x30\x30\x30\x30\x46\x44\x42\x30\x0D");
			break;
		case 1:	//获取系统参数  	7E 32 31 30 31 36 30 34 37 30 30 30 30 46 44 41 42 0D
			*len = sprintf(cmd,"\x7E\x32\x31\x30\x31\x36\x30\x34\x37\x30\x30\x30\x30\x46\x44\x41\x42\x0D");
			break;
		case 2:	//获取机组状态		7E 32 31 30 31 36 30 38 32 30 30 30 30 46 44 41 43 0D
			*len = sprintf(cmd,"\x7E\x32\x31\x30\x31\x36\x30\x38\x32\x30\x30\x30\x30\x46\x44\x41\x43\x0D");
			break;
		default:
			break;
	}
	if(*len){
		n	= (addr>>4)&0x000F;
		cmd[3] = n>9?(n-10+'A'):n+'0';
		n	= addr&0x000F;
		cmd[4] = n>9?(n-10+'A'):n+'0';			

		for(i=1,sum=0; i<13; i++){
			sum += cmd[i];
		}
		sum = sum%65536;
		sum = ~sum + 1;
		n	= (sum>>12)&0x000F;
		cmd[13] = n>9?(n-10+'A'):n+'0';
		n	= (sum>>8)&0x000F;
		cmd[14] = n>9?(n-10+'A'):n+'0';			
		n	= (sum>>4)&0x000F;
		cmd[15] = n>9?(n-10+'A'):n+'0';	
		n	= sum&0x000F;
		cmd[16] = n>9?(n-10+'A'):n+'0';	
	}
}

/**********************************************************************************************************
* 函数名称： static unsigned short chksum(char *buf, int len)
* 函数说明： 电总协议校验数据包
* 输入参数： 数据包缓存区，数据包长度
* 返回参数： 有效数据长度
**********************************************************************************************************/
//static int CheckDataPacket(char *buf, int len)
//{
//	union{
//		unsigned short 	int16;
//      	unsigned char  	buf[2];
//    }Num;	//数据类型转换	
//	unsigned int i,j, sum=0;

//	if(buf[0]!=0x7E || buf[len-1]!=0x0D)  return 0;
//	for(i=1; i<len-5; i++){
//		sum += buf[i];
//	}
//	sum = sum%65536;
//	sum = ~sum + 1;
//	sum &= 0x0000FFFF;
//	
//	for(i=1,j=1; i<len-1; j++){
//		if(buf[i]==0x20){
//			buf[j] = 0;
//		}
//		else{
//			buf[j] = (buf[i] >= '0' && buf[i] <= '9') ? buf[i] - '0' : (buf[i]|32) - 'a' + 10;			
//		}
//		i++;
//		buf[j] <<= 4;
//		if(buf[i]==0x20){
//			buf[j] |= 0;
//		}
//		else{
//			buf[j] |= (buf[i] >= '0' && buf[i] <= '9') ? buf[i] - '0' : (buf[i]|32) - 'a' + 10;			
//		}
//		i++;
//	}
//	Num.buf[1] = buf[j-2];
//	Num.buf[0] = buf[j-1];	
//	if(sum == Num.int16){
//		sum = buf[5]&0x0F;
//		sum += (buf[6]>>4)&0x0F;
//		sum += buf[6]&0x0F;		
//		sum = sum%16;
//		sum = ~sum + 1;	
//		sum = sum&0x0F;
//		if(sum == ((buf[5]>>4)&0x0F)){
//			return j;
//		}
//	}
//	return 0;
//}

/**********************************************************************************************************
* 函数名称： static int parse_fun(short index, int addr, void *data, char *buf, short len)
* 函数说明： 解析传感器响应的数据，并写入数据库
* 输入参数： 解析索引,传感器地址，变量结构体指针，以及响应数据缓存取指针，响应数据长度
* 返回参数： 返回解析结果，返回0成功，返回1失败
**********************************************************************************************************/
static int parse_fun(short index, int addr, void *data, char *buf, short len)
{
	union{
		unsigned short 	int16;
      	unsigned char  	buf[2];
    }Num;	//数据类型转换
	unsigned short i,j, sum;	
	Data_Struct	*d = (Data_Struct*)data;

	if(buf!=NULL && len>0 && buf[0]==0x7E && buf[len-1]==0x0D)
	{
		//开始校验数据的完整性
		for(i=1,sum=0; i<len-5; i++){
			sum += buf[i];
		}
		sum = sum%65536;
		sum = ~sum + 1;
		//将数据转化为十六进制
		for(i=1,j=1; i<len-1; j++){
			if(buf[i]==0x20) buf[j] = 0;
			else buf[j] = (buf[i] >= '0' && buf[i] <= '9') ? buf[i] - '0' : (buf[i]|32) - 'a' + 10;	
			i++;
			buf[j] <<= 4;
			if(buf[i]==0x20) buf[j]|= 0;
			else buf[j]|= (buf[i] >= '0' && buf[i] <= '9') ? buf[i] - '0' : (buf[i]|32) - 'a' + 10;
			i++;
		}
		Num.buf[1] = buf[j-2];
		Num.buf[0] = buf[j-1];	
		if(sum == Num.int16){
			sum = buf[5]&0x0F;
			sum+= (buf[6]>>4)&0x0F;
			sum+= buf[6]&0x0F;		
			sum = sum%16;
			sum = ~sum + 1;	
			sum = sum&0x0F;
			if(sum != ((buf[5]>>4)&0x0F)){
				return 1;
			}
		}
		else{
			return 1;
		}	
		//校验处理完毕，开始解析数据

		switch(index){
			case 0:
				Num.buf[1] = buf[7];
				Num.buf[0] = buf[8];
				d->indoorTemperature.value.fnum = Num.int16 * 0.1;
				Num.buf[1] = buf[9];
				Num.buf[0] = buf[10];
				d->indoorHumidity.value.fnum = Num.int16 * 0.1;					
				Num.buf[1] = buf[11];
				Num.buf[0] = buf[12];
				d->outdoorTemperature.value.fnum = Num.int16 * 0.1;
				break;
			case 1:
				Num.buf[1] = buf[11];
				Num.buf[0] = buf[12];
				d->setTemperature.value.fnum = Num.int16 * 0.1;
				Num.buf[1] = buf[15];
				Num.buf[0] = buf[16];
				d->setHumidity.value.fnum = Num.int16 * 0.1;				
				break;
			case 2:
				d->onoff.value.str						  = buf[8]&0x01?"开机":"关机";
				Set_Var_Status(&d->onoff,					buf[8]&0x01?Normal:Alarm, NULL);
				d->fanStatus.value.str					  = buf[8]&0x02?"运行":"停止";
				Set_Var_Status(&d->fanStatus,				buf[8]&0x02?ON:OFF, NULL);
				d->coolingStatus.value.str				  = buf[8]&0x04?"运行":"停止";
				Set_Var_Status(&d->coolingStatus,			buf[8]&0x04?ON:OFF, NULL);
				d->heatingStatus.value.str				  = buf[8]&0x08?"运行":"停止";
				Set_Var_Status(&d->heatingStatus,			buf[8]&0x08?ON:OFF, NULL);
				d->humidificationStatus.value.str		  = buf[8]&0x10?"运行":"停止";
				Set_Var_Status(&d->humidificationStatus,	buf[8]&0x10?ON:OFF, NULL);
				d->dehumidificationStatus.value.str 	  = buf[8]&0x20?"运行":"停止";
				Set_Var_Status(&d->dehumidificationStatus,	buf[8]&0x20?ON:OFF, NULL);
				
				if(buf[10]&0x01){
					d->pressureAlarm.value.str	= "高压报警";
					Set_Var_Status(&d->pressureAlarm, Alarm, "高压报警");
				}
				else if(buf[10]&0x02){
					d->pressureAlarm.value.str	= "低压报警";
					Set_Var_Status(&d->pressureAlarm, Alarm, "低压报警");						
				}
				else{
					d->pressureAlarm.value.str	= "无报警";
					Set_Var_Status(&d->pressureAlarm, Normal, "无报警");
				}
				
				if(buf[10]&0x04){
					d->temperatureAlarm.value.str	= "高温报警";
					Set_Var_Status(&d->temperatureAlarm, Alarm, "高温报警");
				}
				else if(buf[10]&0x08){
					d->temperatureAlarm.value.str	= "低温报警";
					Set_Var_Status(&d->temperatureAlarm, Alarm, "低温报警");						
				}
				else{
					d->temperatureAlarm.value.str	= "无报警";
					Set_Var_Status(&d->temperatureAlarm, Normal, "无报警");
				}

				if(buf[10]&0x10){
					d->humidityAlarm.value.str	= "高湿报警";
					Set_Var_Status(&d->humidityAlarm, Alarm, "高湿报警");
				}
				else if(buf[10]&0x20){
					d->humidityAlarm.value.str	= "低湿报警";
					Set_Var_Status(&d->humidityAlarm, Alarm, "低湿报警");						
				}
				else{
					d->humidityAlarm.value.str	= "无报警";
					Set_Var_Status(&d->humidityAlarm, Normal, "无报警");
				}					

				d->powerFailureAlarm.value.str			  = buf[10]&0x40?"有报警":"无报警";
				Set_Var_Status(&d->powerFailureAlarm,		buf[10]&0x40?Alarm:Normal, NULL);
				d->shortPeriodAlarm.value.str			  = buf[10]&0x80?"有报警":"无报警";
				Set_Var_Status(&d->shortPeriodAlarm,		buf[10]&0x80?Alarm:Normal, NULL);
				
				d->mainFanMaintenanceAlarm.value.str 	  = buf[11]&0x04?"有报警":"无报警";
				Set_Var_Status(&d->mainFanMaintenanceAlarm,	buf[11]&0x04?Alarm:Normal, NULL);				
				d->humidifierMaintenanceAlarm.value.str	  = buf[11]&0x08?"有报警":"无报警";
				Set_Var_Status(&d->humidifierMaintenanceAlarm,buf[11]&0x08?Alarm:Normal, NULL);
				d->filterMaintenanceAlarm.value.str 	  = buf[11]&0x10?"有报警":"无报警";
				Set_Var_Status(&d->filterMaintenanceAlarm,	buf[11]&0x10?Alarm:Normal, NULL);	
				d->communicationFailureAlarm.value.str	  = buf[11]&0x20?"有报警":"无报警";
				Set_Var_Status(&d->communicationFailureAlarm,buf[11]&0x20?Alarm:Normal, NULL);
				d->coilFreezeAlarm.value.str			  = buf[11]&0x40?"有报警":"无报警";
				Set_Var_Status(&d->coilFreezeAlarm,			buf[11]&0x40?Alarm:Normal, NULL);
				d->humidifierFailureAlarm.value.str		  = buf[11]&0x80?"有报警":"无报警";
				Set_Var_Status(&d->humidifierFailureAlarm,	buf[11]&0x80?Alarm:Normal, NULL);

				d->sensorBoardLossAlarm.value.str		  = buf[12]&0x01?"有报警":"无报警";
				Set_Var_Status(&d->sensorBoardLossAlarm,	buf[12]&0x01?Alarm:Normal, NULL);
				d->exhaustTemperatureFaultAlarm.value.str  = buf[12]&0x02?"有报警":"无报警";
				Set_Var_Status(&d->exhaustTemperatureFaultAlarm,buf[12]&0x02?Alarm:Normal, NULL);
				d->powerLossFaultAlarm.value.str 		  = buf[12]&0x04?"有报警":"无报警";
				Set_Var_Status(&d->powerLossFaultAlarm,		buf[12]&0x04?Alarm:Normal, NULL);					
				d->powerOverVoltageAlarm.value.str		  = buf[12]&0x08?"有报警":"无报警";
				Set_Var_Status(&d->powerOverVoltageAlarm,	buf[12]&0x08?Alarm:Normal, NULL);
				d->powerSupplyPhaseLossAlarm.value.str 	  = buf[12]&0x10?"有报警":"无报警";
				Set_Var_Status(&d->powerSupplyPhaseLossAlarm,buf[12]&0x10?Alarm:Normal, NULL);
				d->powerFrequencyOffsetAlarm.value.str	  = buf[12]&0x20?"有报警":"无报警";
				Set_Var_Status(&d->powerFrequencyOffsetAlarm,buf[12]&0x20?Alarm:Normal, NULL);
				d->floorOverflowAlarm.value.str			  = buf[12]&0x40?"有报警":"无报警";
				Set_Var_Status(&d->floorOverflowAlarm,		buf[12]&0x40?Alarm:Normal, NULL);
				d->energySavingCardFailure.value.str	  = buf[12]&0x80?"有报警":"无报警";
				Set_Var_Status(&d->energySavingCardFailure,	buf[12]&0x80?Alarm:Normal, NULL);
				break;
			default:
				break;
		}
		return 0;
	}
	return 1;
}


/**********************************************************************************************************
* 函数名称： void jmkt_DataMate3000_Registration(void)
* 函数说明： 艾默生精密空调驱动注册
* 输入参数： 无
* 返回参数： 无
**********************************************************************************************************/
void jmkt_DataMate3000_Registration(void)
{
	DeviceDriverRegistration(
		"jmkt",													//设备类型
		"艾默生精密空调",										//设备名称（导航栏默认显示名称）
		"艾默生",												//设备品牌		
		"DataMate3000",											//设备型号
		"本协议是《监控行标第三部分：智能设备通信协议》（电总协议）的简化版本，适用于艾默生网络能源有限公司基站小空调产品DataMate3000系列精密空调的环境监控。",//驱动描述
		var_attr,												//变量属性声明
		sizeof(Data_Struct),									//变量结构体空间大小
		cmd_fun,												//发送指令生成函数
		parse_fun,												//数据解析函数
		1000													//设备响应超时时间
	);
#if 0
	#define	CMD1	"\x7E\x32\x31\x30\x31\x36\x30\x34\x32\x30\x30\x30\x30\x46\x44\x42\x30\x0D"
	#define	RSP1	"\x7E\x32\x31\x30\x31\x36\x30\x30\x30\x34\x30\x30\x43\x30\x30\x43\x42\x20\x20\x20\x20\x20\x20\x20\x20\x46\x42\x42\x41\x0D"
	#define	CMD2	"\x7E\x32\x31\x30\x31\x36\x30\x34\x37\x30\x30\x30\x30\x46\x44\x41\x42\x0D"
	#define	RSP2	"\x7E\x32\x31\x30\x31\x36\x30\x30\x30\x35\x30\x31\x41\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x43\x38\x30\x30\x31\x45\x30\x31\x39\x30\x30\x30\x33\x32\x30\x30\x46\x38\x37\x46\x0D"
	#define	CMD3	"\x7E\x32\x31\x30\x31\x36\x30\x38\x32\x30\x30\x30\x30\x46\x44\x41\x43\x0D"
	#define	RSP3	"\x7E\x32\x31\x30\x31\x36\x30\x30\x30\x34\x30\x30\x43\x30\x31\x30\x37\x30\x33\x30\x30\x30\x30\x30\x30\x46\x42\x35\x34\x0D"					
	VirtualFrameRegistration(CMD1, sizeof(CMD1)-1, RSP1, sizeof(RSP1)-1);
	VirtualFrameRegistration(CMD2, sizeof(CMD2)-1, RSP2, sizeof(RSP2)-1);
	VirtualFrameRegistration(CMD3, sizeof(CMD3)-1, RSP3, sizeof(RSP3)-1);						
#endif	
}

